package com.itheima.stream;

import org.w3c.dom.ls.LSOutput;

import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/*
各种获取流的操作
 */
public class Demo03 {


    public static void main(String[] args) {
        int[] arr= {11,22,33,44,55};
        //数组工具类  Arrays.
        IntStream stream = Arrays.stream(arr);
        stream.forEach(s-> System.out.println(s));
        System.out.println(stream);
        //单列集合

        ArrayList<String> list = new ArrayList<>(List.of("坤坤", "签签", "滔滔", "鹿鹿"));
        list.stream().forEach(s-> System.out.println(s));

        HashSet<String> set = new HashSet<>(Set.of("坤坤", "签签", "滔滔", "鹿鹿"));
        set.stream().forEach(s-> System.out.println(s));



        //双列集合(Map 不能直接获取流 但是可以间接获取流  先获取键  通过键的集合获取流
        //获取键值对 , 获取键值对的流)
        HashMap<String, String> map = new HashMap<>(Map.ofEntries(Map.entry("宋喆", "马蓉"), Map.entry("PGone", "小璐")));
        map.keySet().stream().forEach(s-> System.out.println(s));

        map.entrySet().stream().forEach(s-> System.out.println(s));
        // 广坤    四哥  能哥  大拿
        Stream<String> stream2 = Stream.of("广坤", "四哥", "能哥", "大拿");
        stream2.forEach(s-> System.out.println(s));

    }

}
